"use strict";

var router = require("router"),
    Q = require('q'),
    timers = require('timers');



function ScheduleService() {
    console.log("ScheduleService constructor");
}
ScheduleService.prototype.constructor = ScheduleService;

/*-------------------------------------------------------*/
/*common */
ScheduleService.prototype.start = function () {
    var self = this;

    return Q.fcall(function () {
        self.intervalId = timers.setInterval(function () {
            return require("./alertservice").mongoArchive().catch(function(error){
                console.log(error);
            }).done();
        }, 300000);

        //TODO supprimer les "research" trop vieilles
    });
};


exports = module.exports = new ScheduleService();